package day01;

/**
 * @author Jetwang
 * @version 1.0
 * @since 2023/3/11 21:57
 * 青蛙跳台阶问题
 */
public class Offer10B {

    public int numWays(int n) {
        if (n < 2) {
            return 1;
        }
        int n1 = 1;
        int n2 = 2;
        int res = 0;
        for(int i = 2; i <= n; i++) {
            res = (n1 + n2) % 1000000007;
            n1 = n2;
            n2 = res;
        }
        return res;
    }
}
